<?php

Yii::import('application.models._base.BaseResourceImg');


class ResourceImg extends BaseResourceImg
{
	public static function model($className=__CLASS__) {
		return parent::model($className);
	}
	
	public function buildResource($resource){
	    $resourceData = $this->findByAttributes(array('path' => $resource['path']));
	    if (empty($resourceData)){
	        $this->attributes = $resource;
	        $this->save();	   
	    }else{
	        $this->id = $resourceData->id;
	    }
	    return $this->id;
	}
	
}